// Logistics/Index/Index.js


let menuBehavior = require('../behavior/menuNavigator')
Page({
  behaviors: [ menuBehavior, ],

  /**
   * 页面的初始数据
   */
  data: {
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    let {orderid,redirect} = options;
    wx.hideHomeButton({});
    if (redirect) {
      wx.navigateTo({url: `${redirect}?orderid=${orderid}`});
      return
    }
    if (orderid) this.setData({orderid});
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    let loginType = wx.getStorageSync('loginType'),
      navList = [];
    if (loginType === 'login') {
      navList = [
        {title: '分拨中心', icon: '',style:'#99cc33',url: '/Logistics/MenuPage/MenuPage?type=distribution'},
        {title: '货损', icon: '',style:'#1ba838',url: '/Logistics/MenuPage/MenuPage?type=damage'},
        {title: '运单详情', icon:'',style: '#f3c800',url: '/Logistics/Waybill/Waybill',isScan: true},
        {title: '个人中心', icon:'',style: '#f59206',url: '/Logistics/Personal/Personal'}
      ];
    }else {
      navList = [
        {title: '装货', icon: '',style:'#99cc33',url: '/Logistics/LoadGoods/LoadGoods',isScan: true},
        {title: '运输', icon:'',style: '#4bc332',url: '/Logistics/Transport/Transport',isScan: true},
        {title: '签收', icon:'',style: '#1ba838',url: '/Logistics/Sign/Sign',isScan: true},
        {title: '货损', icon: '',style:'#336699',url: '/Logistics/MenuPage/MenuPage?type=damage'},
        {title: '运单情况', icon:'',style: '#f3c800',url: '/Logistics/Waybill/Waybill',isScan: true},
        {title: '个人中心', icon:'',style: '#f59206',url: '/Logistics/Personal/Personal'}
        ]
    }
    this.setData({navList});

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})
